import { TPropertiesMessage } from "../../../Message/Db/Tables/TPropertiesMessage";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
//class PropertiesMsgConfig
    
    export  class PropertiesMsgConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (PropertiesMsgConfig._instance != null) 
            {
                throw new Error(" ResConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TPropertiesMessage();
                loc1.msgId = loc2.msgId;
                loc1.msgKey = StringHelper.getString(loc2.msgKey);
                loc1.msgDesc = StringHelper.getString(loc2.msgDesc);
                loc1.msgValue = StringHelper.getString(loc2.msgValue);
                this._map[loc1.msgKey] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_properties_message.json");
            this.write(loc1);
            return;
        }

        public getInfoByKey(arg1: string): TPropertiesMessage
        {
            return this._map[arg1];
        }

        public static get instance(): PropertiesMsgConfig
        {
            if (PropertiesMsgConfig._instance == null) 
            {
                PropertiesMsgConfig._instance = new PropertiesMsgConfig();
            }
            return PropertiesMsgConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: PropertiesMsgConfig;
    }
